package org.domain.sigerec.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import org.hibernate.validator.NotNull;

@Entity
public class Reserva implements Serializable {
	
	private static final long serialVersionUID = 3543335162347139912L;
	private Long id;
	private BigDecimal preco;
	private Long numero;
	private Cruzeiro cruzeiro;
	private List<Cabine> cabines;
	private List<Cliente> clientes;
	
	public Reserva() {
		
	}
	
	@Id @GeneratedValue
	public Long getId() {
	     return id;
	}

	public void setId(Long id) {
	     this.id = id;
	}

	public BigDecimal getPreco() {
		return preco;
	}

	public void setPreco(BigDecimal preco) {
		this.preco = preco;
	}

	public Long getNumero() {
		return numero;
	}

	public void setNumero(Long numero) {
		this.numero = numero;
	}

	public void setCruzeiro(Cruzeiro cruzeiro) {
		this.cruzeiro = cruzeiro;
	}

	@ManyToOne
	@JoinColumn(name = "cruzeiro_id")
	public Cruzeiro getCruzeiro() {
		return cruzeiro;
	}

	public void setCabines(List<Cabine> cabines) {
		this.cabines = cabines;
	}

	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "RESERVA_CABINE",
			joinColumns = @JoinColumn(name = "reserva_id"),
			inverseJoinColumns = @JoinColumn(name = "cabine_id"))
	public List<Cabine> getCabines() {
		return cabines;
	}

	public void setClientes(List<Cliente> clientes) {
		this.clientes = clientes;
	}

	@ManyToMany(mappedBy="reservas", fetch=FetchType.LAZY)
	@NotNull
	public List<Cliente> getClientes() {
		return clientes;
	}   	
	
	
}
